package com.ym.medical.enums;

import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.util.StdConverter;
import com.ym.common.annotations.EnumDescription;
import com.ym.common.constant.DictEnum;

/**
 * 优惠劵-折扣
 */
@EnumDescription("优惠劵-折扣")
public enum CouponDiscountEnum implements DictEnum {

    //--------------------start-----------------

    /**
     * 九折
     */
    NINE_DISCOUNT("0.9","九折"),
    /**
     * 八折
     */
    EIGHT_FOLD("0.8","八折"),
    /**
     * 七折
     */
    SEVEN_FOLD("0.7","七折"),
    /**
     * 六折
     */
    SIX_FOLD("0.6","六折"),
    /**
     * 五折
     */
    FIVE_FOLD("0.5","五折"),
    /**
     * 四折
     */
    FOUR_FOLD("0.4","四折"),
    /**
     * 三折
     */
    THREE_FOLD("0.3","三折"),
    /**
     * 二折
     */
    TWO_FOLD("0.2","二折"),
    /**
     * 一折
     */
    A_DISCOUNT("0.1","一折"),

    //--------------------end-------------------
    ;
    private String key;

    private String value;

    CouponDiscountEnum(String key, String value) {
        this.key = key;
        this.value = value;
    }

    @Override
    public String getKey() {
        return this.key;
    }

    @Override
    public String getValue() {
        return this.value;
    }


    /**
     * 序列化使用
     */
    public static class Covert extends StdConverter<String, JSONObject> {
        @Override
        public JSONObject convert(String value) {
            return DictEnum.valueOfJson(CouponDiscountEnum.class, value);
        }
    }
}
